package com.guanghua.brick.html;

public class CommonDepend implements IDepend {
	
	private String dependId = null;
	private String dependName = null;
	private boolean weakDepend = false;
	
	public String buildScripts(String controlId) {
		StringBuffer ret = new StringBuffer();
		ret.append(controlId).append(".dependOn(\"")
			.append(dependId)
			.append("\", ")
			.append(Boolean.toString(weakDepend));
		//depend需要提交的参数名称
		if (dependName != null)	
			ret.append(", \"")
			.append(dependName)
			.append("\"");
		
		ret.append(");");
		
		return ret.toString();
	}

	public String getDependId() {
		return dependId;
	}

	public void setDependId(String dependId) {
		this.dependId = dependId;
	}

	public String getDependName() {
		return dependName;
	}

	public void setDependName(String dependName) {
		this.dependName = dependName;
	}

	public boolean isWeakDepend() {
		return weakDepend;
	}

	public void setWeakDepend(boolean weakDepend) {
		this.weakDepend = weakDepend;
	}
}
